<%@page import="java.util.HashMap"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Khutro - Control panel</title>

<link rel="stylesheet" type="text/css" href="khutro/css/khutro.css">
<link rel="stylesheet" type="text/css" href="khutro/css/jquery-ui.css">
<script type="text/javascript" src="khutro/js/jq.js"></script>
<script type="text/javascript" src="khutro/js/jq2.js"></script>
<script type="text/javascript" src="js/search.js"></script>
<script src="js/gen_validatorv4.js" type="text/javascript"></script>
<script type="text/javascript" src="khutro/js/calendar.js"></script>
<script type="text/javascript" src="khutro/js/superfish.js"></script>
<script type="text/javascript"><!--
$(document).ready(function() {
	$('#menu > ul').superfish({
		hoverClass	 : 'sfHover',
		pathClass	 : 'overideThisToUse',
		delay		 : 0,
		animation	 : {height: 'show'},
		speed		 : 'normal',
		autoArrows   : false,
		dropShadows  : false, 
		disableHI	 : false, /* set to true to disable hoverIntent detection */
		onInit		 : function(){},
		onBeforeShow : function(){},
		onShow		 : function(){},
		onHide		 : function(){}
	});
	
	$('#menu > ul').css('display', 'block');
});
function checkadmin(){
	var role = ${userRoleIdss};
	
}
//-->
</script> 
</head>
<body onload="checkadmin();">
<form action="">
	<input type="hidden" id="roleId"/>
</form>
<c:choose>

<c:when test="${userRoleIdss ==1 }">
<script language="javascript" type="text/javascript">
<!--
var dle_act_lang   = ["Yes", "No", "Enter", "Cancel"];
//-->
</script>
<div id="loading-layer"><div id="loading-layer-text">Please wait...</div></div>

<div id="container">
<div id="header">
  <div class="div1">
    <div class="div2"><img src="khutro/images/logo.png" title="Administration" onclick="location = adminloadsystem.action" alt=""></div>
        <div class="div3"><img src="./khutro/images/lock.png" alt="" style="position: relative; top: 3px;">&nbsp;Welcome:  <span><s:property value="#session['displayNamess']" /> (Administrator)</span> &nbsp; <a href="logout.action" class="navigation">Logout</a></div>
      </div>
    <div id="menu">
    <ul class="left sf-js-enabled" style="display: block; ">
      <li><a href="adminloadsystem.action" class="top">Quick Links</a>
        <ul style="display: none; visibility: hidden; ">
          <li><a href="checkaddtopic.action">Add PostNews</a></li>
          <li><a href="checkaddsharetopic.action">Add ShareNews</a></li>
          <li><a href="admin-listtopicload.action">Edit (Reviews/Approve) News</a></li>
          <li><a href="adminspamtopicdo.action">Report Topic</a></li>
          <li><a href="admin-locationload.action">Location</a></li>
        </ul>
      </li>
      <li class=""><a class="top">User Management</a>
        <ul style="visibility: hidden; display: none; ">
          <li><a href="admin-userlistload.action">Users</a></li>
          <li><a href="profileuser.action">Admin Profile </a></li>
        </ul>
      </li>
      <li class=""><a class="top" href="adminlogs.action">Activity Logs and Monitors</a>
      </li>
    </ul>
    <ul style="display: block; " class="right sf-js-enabled">
      <li><a href="adminloadsystem.action" class="top">Quick Links</a></li>
      <li style="cursor:pointer !important"><a onclick="window.open('index.action');" class="top">View Live Site</a></li>
<!--      <li><a class="top" href="/admin.jsp?action=logout">Logout</a></li> -->
    </ul>
  </div>
  </div>
<div id="content">

<table align="center" id="main_body" style="width: 98%; ">
    <tbody><tr>
        <td width="4" height="16"><img src="khutro/images/tb_left.gif" width="4" height="16" border="0"></td>
		<td background="khutro/images/tb_top.gif"><img src="khutro/images/tb_top.gif" width="1" height="16" border="0"></td>
		<td width="4"><img src="khutro/images/tb_right.gif" width="3" height="16" border="0"></td>
    </tr>
	<tr>
        <td width="4" background="khutro/images/tb_lt.gif"><img src="khutro/images/tb_lt.gif" width="4" height="1" border="0"></td>
		<td valign="top" style="padding-top:12px; padding-left:13px; padding-right:13px;" bgcolor="#FAFAFA">
		
<div style="padding-top:5px;">
<table width="100%">
    <tbody><tr>
        <td width="4"><img src="khutro/images/tl_lo.gif" width="4" height="4" border="0"></td>
        <td background="khutro/images/tl_oo.gif"><img src="khutro/images/tl_oo.gif" width="1" height="4" border="0"></td>
        <td width="6"><img src="khutro/images/tl_ro.gif" width="6" height="4" border="0"></td>
    </tr>
    <tr>
      <td><img src="khutro/images/tl_lu.gif" width="4" height="6" border="0"></td>
      <td background="khutro/images/tl_ub.gif"><img src="khutro/images/tl_ub.gif" width="1" height="6" border="0"></td>
      <td><img src="khutro/images/tl_ru.gif" width="6" height="6" border="0"></td>
    </tr>
</tbody></table>
</div>
<!--MAIN area--><!-- calendar stylesheet -->
<link rel="stylesheet" type="text/css" media="all" href="khutro/css/calendar-blue.css" title="win2k-cold-1">
<form action="adminspamtopicdo.action" method="POST" name="optionsbar" id="optionsbar">
  <div style="padding-top:5px;padding-bottom:2px;display:none" name="advancedsearch" id="advancedsearch">
    <table width="100%">
    <tbody><tr>
        <td width="4"><img src="khutro/images/tl_lo.gif" width="4" height="4" border="0"></td>
        <td background="khutro/images/tl_oo.gif"><img src="khutro/images/tl_oo.gif" width="1" height="4" border="0"></td>
        <td width="6"><img src="khutro/images/tl_ro.gif" width="6" height="4" border="0"></td>
    </tr>
    <tr>
        <td background="khutro/images/tl_lb.gif"><img src="khutro/images/tl_lb.gif" width="4" height="1" border="0"></td>
        <td style="padding:5px;" bgcolor="#FFFFFF">
<table width="100%">
    <tbody><tr>
        <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation"><b>Search topics spam</b></div></td>
    </tr>
</tbody></table>
<div class="unterline"></div>
<table width="100%">
     <tbody><tr>
		<td style="padding:5px;">Search for news: </td>
		<td style="padding-left:5px;"><input class="edit bk" name="search_field" value="${search_field }" type="text" size="35"></td>
		<td style="padding-left:5px;">Search by authors:</td>
		<td style="padding-left:22px;"><input class="edit bk" name="search_author" value="${search_author }" type="text" size="36"></td>

    </tr>
     <tr>
		<td style="padding:5px;">City: </td>
		<td style="padding-left:5px;"><select name="city" id="city" class="tbdownlist">
									
									<option value="0">-Thành Phố-</option>
									<s:iterator value="lstProvince">
										<c:choose>
											<c:when test="${city==provinceId}">
												<option value="${provinceId}" selected>${provinceName}</option>
											</c:when>
											<c:otherwise>
												<option value="${provinceId}">${provinceName}</option>
											</c:otherwise>
										</c:choose>	
									</s:iterator>
								</select></td>
		<td style="padding-left:5px;">Sort by date:</td>
		<td style="padding-left:5px;">from <input type="text" name="fromnewsdate" id="fromnewsdate" size="11" maxlength="16" class="edit bk" value="${fromnewsdate }">
<img src="khutro/images/img.gif" align="absmiddle" id="f_trigger_dnews" style="cursor: pointer; border: 0" title="Choose date by calendar ">
<script type="text/javascript">
    Calendar.setup({
      inputField     :    "fromnewsdate",     // id of the input field
      ifFormat       :    "%Y-%m-%d",      // format of the input field
      button         :    "f_trigger_dnews",  // trigger for the calendar (button ID)
      align          :    "Br",           // alignment 
		  timeFormat     :    "24",
		  showsTime      :    false,
      singleClick    :    true
    });
</script> to <input type="text" name="tonewsdate" id="tonewsdate" size="11" maxlength="16" class="edit bk" value="${tonewsdate }">
<img src="khutro/images/img.gif" align="absmiddle" id="f_trigger_tnews" style="cursor: pointer; border: 0" title="Choose date by calendar ">
<script type="text/javascript">
    Calendar.setup({
      inputField     :    "tonewsdate",     // id of the input field
      ifFormat       :    "%Y-%m-%d",      // format of the input field
      button         :    "f_trigger_tnews",  // trigger for the calendar (button ID)
      align          :    "Br",           // alignment 
		  timeFormat     :    "24",
		  showsTime      :    false,
      singleClick    :    true
    });
</script></td>

    </tr>
     <tr>
		<td style="padding:5px;">District:</td>
		<td style="padding-left:5px;">
			<select name="district" id="district" class="tbdownlist">
				<s:if test="lstDistrict==null">
				<option value="0">-Quận huyện-</option>
				</s:if>
				<s:iterator value="lstDistrict">
					<c:choose>
						<c:when test="${district == districtId}">
							<option value="${districtId}" selected="selected">${districtName}</option>
						</c:when>
						<c:otherwise>
							<option value="${districtId}">${districtName}</option>
						</c:otherwise>
					</c:choose>
				</s:iterator>
			</select>
		</td>
		<td style="padding-left:5px;">News per page: </td>
		<td style="padding-left:22px;">
			<s:if test="news_per_page!=0">
				<input class="edit bk" style="text-align: center" name="news_per_page" id="news_per_page" value="${news_per_page}" type="text" size="36">
			</s:if>
			<s:else>
				<input class="edit bk" style="text-align: center" name="news_per_page" id="news_per_page" value="50" type="text" size="36">
			</s:else>
		</td>

    </tr>
    <tr>
        <td colspan="4"><div class="hr_line"></div></td>
    </tr>
    <tr>
        <td style="padding:5px;">Types</td>
        <td style="padding:5px;">Status</td>
        <td style="padding:5px;">Sort by date:</td>
       
    </tr>
    <tr>
        <td style="padding-left:2px;"><select name="search_topic_type" id="search_topic_type">
        	<option value="0">-All-</option>
									<s:iterator value="lstTopictypes">
										<c:choose>
											<c:when test="${search_topic_type==topicTypeId}">
												<option value="${topicTypeId}" selected>${topicTypeName}</option>
											</c:when>
											<c:otherwise>
												<option value="${topicTypeId}">${topicTypeName}</option>
											</c:otherwise>
										</c:choose>						
									</s:iterator>
            </select>
        </td>
        <td style="padding-left:2px;"><select name="search_topic_status" id="search_topic_status">
        	<option value="0">-All-</option>
									<s:iterator value="lstStatustopics">
										<c:choose>
											<c:when test="${search_topic_status==statusTopicId}">
												<option value="${statusTopicId}" selected>${statusTopicName}</option>
											</c:when>
											<c:otherwise>
												<option value="${statusTopicId}">${statusTopicName}</option>
											</c:otherwise>
										</c:choose>						
									</s:iterator>
            </select>
        </td>
        <td style="padding-left:2px;"><select name="search_order_d" id="search_order_d">
           <s:if test="search_order_d=='desc'">
				<option value="0">-- </option>
				<option selected value="desc">Descending</option>
				<option value="asc">Ascending</option>
		   </s:if>
		   <s:elseif test="search_order_d=='asc'">
				<option value="0">-- </option>
				<option value="desc">Descending</option>
				<option selected value="asc">Ascending</option>
			</s:elseif>
			<s:else>
				<option selected value="0">-- </option>
				<option value="desc">Descending</option>
				<option value="asc">Ascending</option>
			</s:else>	
            </select>
        </td>
        
    </tr>
    <tr>
        <td colspan="4"><div class="hr_line"></div></td>
    </tr>
    <tr>
		<td style="padding:5px;">&nbsp;</td>
		<td colspan="3">
<input type="hidden" name="start_from" id="start_from" value="">
<input class="edit" type="submit" value="Find"></td>

    </tr>
</tbody></table>
</td>
        <td background="khutro/images/tl_rb.gif"><img src="khutro/images/tl_rb.gif" width="6" height="1" border="0"></td>
    </tr>
    <tr>
        <td><img src="khutro/images/tl_lu.gif" width="4" height="6" border="0"></td>
        <td background="khutro/images/tl_ub.gif"><img src="khutro/images/tl_ub.gif" width="1" height="6" border="0"></td>
        <td><img src="khutro/images/tl_ru.gif" width="6" height="6" border="0"></td>
    </tr>
</tbody></table>
</div>
</form><script language="JavaScript" type="text/javascript">

function ckeck_uncheck_all() {
    var frm = document.editnews;
    for (var i=0;i<frm.elements.length;i++) {
        var elmnt = frm.elements[i];
        if (elmnt.type=='checkbox') {
            if(frm.master_box.checked == true){ elmnt.checked=false; }
            else{ elmnt.checked=true; }
        }
    }
    if(frm.master_box.checked == true){ frm.master_box.checked = false; }
    else{ frm.master_box.checked = true; }
}

</script><script language="javascript" type="text/javascript">
<!--
function cdelete(id){

	    DLEconfirm( 'Press OK to delete all comments', 'Confirm', function () {
			document.location='deletetopic.action?topicId='+id;
		} );
}
function MenuBuild( m_id, m_link ){

var menu=new Array()

menu[0]='<a href="' + m_link + '" target="_blank">View</a>';
menu[1]='<a href="?mod=comments&action=edit&id=' + m_id + '">Edit</a>';
menu[2]='<a onClick="javascript:cdelete(' + m_id + '); return(false)" href="?mod=comments&user_hash=205ffa0eaca325b33e574908b88fcd27&action=dodelete&id=' + m_id + '" >Remove all</a>';

return menu;
}
//-->
</script>
<form action="admineditspamtopic.action" method="post" name="editnews">
<div style="padding-top:5px;padding-bottom:2px;">
<table width="100%">
    <tbody><tr>
        <td width="4"><img src="khutro/images/tl_lo.gif" width="4" height="4" border="0"></td>
        <td background="khutro/images/tl_oo.gif"><img src="khutro/images/tl_oo.gif" width="1" height="4" border="0"></td>
        <td width="6"><img src="khutro/images/tl_ro.gif" width="6" height="4" border="0"></td>
    </tr>
    <tr>
        <td background="khutro/images/tl_lb.gif"><img src="khutro/images/tl_lb.gif" width="4" height="1" border="0"></td>
        <td style="padding:5px;" bgcolor="#FFFFFF">
<table width="100%">
    <tbody><tr>
        <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">List of report topic</div></td>
        <td bgcolor="#EFEFEF" height="29" style="padding:5px;" align="right"><a href="javascript:ShowOrHide('advancedsearch');">Extended news search</a></td>
    </tr>
</tbody></table>
<div class="unterline"></div>
<table width="100%">
    <tbody><tr>
        <td>
	<table width="100%" id="newslist">
	<tbody><tr class="thead">
    <th width="333">&nbsp;&nbsp;Title</th>
	<th width="73" align="left">Status</th>
    <th width="473" align="left">Description report</th>
    <th width="155">Rerort by</th>
    <th width="100">Posted by</th>
    <th width="18" align="center"><input type="checkbox" name="master_box" title="Select all" onclick="javascript:ckeck_uncheck_all()"></th>
	</tr>
	<tr class="tfoot"><td background="khutro/images/mline.gif" height="1" colspan="8"></td>
	</tr><tr class="tfoot"><td background="khutro/images/mline.gif" height="1" colspan="8"></td>
	</tr>

	<display:table id="lstTopics" name="lstTopics" pagesize="${news_per_page}"
					requestURI="/adminspamtopicdo.action" offset="1">
					<display:column>
	<tr>
        <td class="list" style="padding:4px;width:333">
        ${lstTopics[3]} -<font color="red">&nbsp; </font><a title="Edit articles" class="list" href="detail.action?topicId=${lstTopics[4]}&districtId=${lstTopics[7]}">${lstTopics[0]}</a>
        </td>
        <td style="width:73;text-align: left;">${lstTopics[13]}</td>
        <td style="width:473;text-align: left;">${lstTopics[16]}</td>
        <td class="list" style="width:155;">${lstTopics[15]}</td>
        <td class="list" style="width:100px;">${lstTopics[8]}</td>
        <td align="center" style="width:18px;text-align: left;"><input name="selected_news" id="selected_news" value="${lstTopics[4]}" type="checkbox">

             </td></tr>
             <tr><td background="khutro/images/mline.gif" height="1" colspan="8"></td></tr>
             </display:column>
             </display:table>
            <tr><td background="khutro/images/mline.gif" height="1" colspan="8"></td></tr>
            <tr class="tfoot">
<th colspan="6" align="left" valign="top"><div style="margin-bottom:5px; margin-top:5px; text-align: right;">
<select name="massactions">
<option value="">- perform action -</option>
<option value="mass_hide_topic">Hide topic</option>
<option value="mass_show_topic">Show topic</option>
<option value="mass_out_spam">Out report</option>
<option value="mass_delete">Remove</option>
</select>
<input class="edit" type="submit" value="Apply">
</div></th></tr>
</tbody></table>
</td>
    </tr>
</tbody></table>
</td>
        <td background="khutro/images/tl_rb.gif"><img src="khutro/images/tl_rb.gif" width="6" height="1" border="0"></td>
    </tr>
    <tr>
        <td><img src="khutro/images/tl_lu.gif" width="4" height="6" border="0"></td>
        <td background="khutro/images/tl_ub.gif"><img src="khutro/images/tl_ub.gif" width="1" height="6" border="0"></td>
        <td><img src="khutro/images/tl_ru.gif" width="6" height="6" border="0"></td>
    </tr>
</tbody></table>
</div></form>
<script type="text/javascript">
$(function(){

	$("#newslist").delegate("tr", "hover", function(){
	  $(this).toggleClass("hoverRow");
	});

});
</script>	 <!--MAIN area-->
	<div style="height:8px; display:block"></div>

		</td>
		<td width="4" background="khutro/images/tb_rt.gif"><img src="khutro/images/tb_rt.gif" width="4" height="1" border="0"></td>
    </tr>
	<tr>
        <td height="16" background="khutro/images/tb_lb.gif"></td>
		<td background="khutro/images/tb_tb.gif"></td>
		<td background="khutro/images/tb_rb.gif"></td>
    </tr>
</tbody></table>

<div style="padding-bottom:10px;">
<table width="100%">
    <tbody><tr>
        <td height="40" align="center" style="padding-right:10px;background: #FAFAFA url('engine/skins/images/footer.gif') repeat-x 0 0;"><div class="navigation">Fu Team | FSH-Project<br>Copyright 2012©. All rights reserved.</div></td>
    </tr>
</tbody></table></div>	
</div>

</div>

<script language="javascript" type="text/javascript">
<!--
function getClientWidth()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}
var main_body_size = getClientWidth();

if (main_body_size > 1300) document.getElementById('main_body').style.width = "1200px";

//-->
</script>


<div id="hintbox"></div>
<script language="JavaScript" type="text/javascript"
		xml:space="preserve">
		//         
		var frmvalidator = new Validator("optionsbar");
		
		frmvalidator.addValidation("news_per_page", "numeric", "News per page: must is number");
		
	</script>
</c:when>
<c:otherwise>
	<c:redirect url="adminlogin.jsp"/>
</c:otherwise>
</c:choose>
</body></html>